<?php

class ProvinceController extends BaseController
{
    protected $tableName = "province";
    protected $pk = "province_id";

    // GET 获取某个省份下的所有城市
    public function getCitiesInProvince($provinceId) {
        $sql = "SELECT * 
                FROM province
                INNER JOIN city
                    ON province.province_id = city.province_id
                WHERE province.province_id = $provinceId";
        $result = $this->conn->query($sql);
        $data = $this->getArrayDataFromResult($result);
        return ReturnHelper::success($data, "省份`$provinceId`下的所有城市请求成功");
    }
}